<!DOCTYPE html>

<html>

<head>
    <meta charset="utf-8">
    <title>用户中心</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="../../../layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../../layuiadmin/style/admin.css" media="all">
</head>

<body ng-app="app" ng-controller="listContextController">

    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
        <legend> <a class="layui-btn layui-btn-primary" href="javascript:history.go(-1);">返回</a>---个人信息：{{userinfo.name}}</legend>
    </fieldset>
    <table class="layui-table">
        <colgroup>
            <col width="150">
            <col width="200">
            <col>
        </colgroup>
        <thead>
            <tr>
                <th>编号</th>
                <th>名字</th>
                <th>年龄</th>
                <th>电话</th>
                <th>生日</th>
                <th>便签</th>
                <th>加入时间</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>{{userinfo.sid}}</td>
                <td>{{userinfo.name}}</td>
                <td>{{userinfo.age}}</td>
                <td>{{userinfo.phone}}</td>
                <td>{{userinfo.birthday}}</td>
                <td>{{userinfo.typeStudent.names}}</td>
                <td>{{userinfo.createTime}}</td>
            </tr>
        </tbody>
    </table>
    <div class="layui-tab">
        <ul class="layui-tab-title">
            <li class="layui-this">个人体质测试</li>
            <li>个人技能测试</li>

        </ul>
        <div class="layui-tab-content">
            <!--个人体质测试 start-->
            <div class="layui-tab-item layui-show">
                <table class="layui-table" lay-even lay-skin="nob">
                    <thead>
                        <tr>
                            <th>类型</th>
                            <th>测试时间</th>
                            <th><button type="button" class="layui-btn" ng-click="selectStudentContisdLists2()"><i class="layui-icon">&#xe669;</i> </button></th>
                            <th><a class="layui-btn layui-btn-danger" href="../../component/form/element.html?sid={{userinfo.sid}}"><i class="layui-icon">&#xe608;</i> 添加体质测试</a></th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr ng-repeat='consuserinfo in consitiontion track by $index'>
                            <td>{{consuserinfo.constionParent.content}}</td>
                            <td>{{consuserinfo.createTime}}</td>
                            <td><a href="../../component/form/element-update.html?cid={{consuserinfo.cid}}" class="layui-btn layui-btn-sm layui-btn-normal"><i class="layui-icon">&#xe642;</i>查看详情 / 修改</a></td>
                            <td><a href="../../info/infoexpot.html?cid={{consuserinfo.cid}}" class="layui-btn layui-btn-sm layui-btn-normal"  target="_blank"><i class="layui-icon">&#xe642;</i>导出</a></td>
                            <td><button type="button" class="layui-btn layui-btn-sm layui-btn-warm" ng-click="deleteContisdCid(consuserinfo.cid)"> <i class="layui-icon">&#xe640;</i></button></td>
                        </tr>

                    </tbody>
                </table>

            </div>
            <!--个人体质测试 end-->
            <!--个人技能测试start-->
            <div class="layui-tab-item">
                <table class="layui-table" lay-even lay-skin="nob">
                    <thead>
                        <tr>
                            <th>等级</th>
                            <th>加入时间</th>
                            <th>签名</th>
                            <th><a class="layui-btn layui-btn-danger" href="../../component/form/leveakillstudent-add.html?sid={{userinfo.sid}}">添加技能测试</a></th>
                        </tr>
                    </thead>
                    <tbody>

                        <tr ng-repeat='leaveakill in leaveakillList track by $index'>
                            <td>{{leaveakill.killContextId}}</td>
                            <td>{{leaveakill.createTime}}</td>
                            <td><a href="../../component/form/leveakillstudent-update.html?leId={{leaveakill.leId}}&sid={{userinfo.sid}}" class="layui-btn layui-btn-sm layui-btn-normal"><i class="layui-icon">&#xe642;</i>查看详情 / 修改</a></td>
                            <td><a href="../../info/infoexpot-levea.html?leId={{leaveakill.leId}}" class="layui-btn layui-btn-sm layui-btn-normal"  target="_blank"><i class="layui-icon">&#xe642;</i>导出</a></td>
                            <td><button type="button" class="layui-btn layui-btn-sm layui-btn-warm" ng-click="deletetLevelkillStudent(leaveakill.leId)"> <i class="layui-icon">&#xe640;</i></button></td>

                        </tr>
                    </tbody>
                </table>
            </div>
            <!--个人技能测试end-->
        </div>
    </div>




    <script src="../../../layuiadmin/layui/layui.js"></script>
    <script src="../../../layuiadmin/jquery/jquery-1.11.1.min.js"></script>
    <script src="../../../layuiadmin/url.js"></script>
    <script src="../../../layuiadmin/jquery/angular.js"></script>
    <script>
        layui.use('element', function() {
            var element = layui.element;

            function refst() {
                layer.msg("刷新成功");
            }
        });

        function getQueryVariable(variable) {
            var query = window.location.search.substring(1);
            var vars = query.split("&");
            for (var i = 0; i < vars.length; i++) {
                var pair = vars[i].split("=");
                if (pair[0] == variable) {
                    return pair[1];
                }
            }
            return (false);
        }



        var app = angular.module('app', []);
        app.controller('listContextController', ['$scope', '$http', function($scope, $http) {
            $scope.selectStudent = function() {
                var sid = getQueryVariable("sid");
                $http({
                    method: 'GET',
                    url: applicationUrl + 'student/api/byid',
                    headers: {
                        "Content-Type": 'application/x-www-form-urlencoded'
                    },
                    params: {
                        sid: sid
                    },
                }).success(function(result) {
                    $scope.userinfo = result.data;
                    if (result.data != null) {
                        $scope.selectStudentContisdList();
                    }

                }).error(function(data, status) {
                    console.log(" ");

                });
            };
            //加载用户信息
            $scope.selectStudent();
            //加载体质测试
            $scope.selectStudentContisdList = function() {
                // var sid = getQueryVariable("sid");
                $http({
                    method: 'POST',
                    url: applicationUrl + 'constitution/api/listBySid',
                    headers: {
                        "Content-Type": 'application/x-www-form-urlencoded'
                    },
                    params: {
                        sid: $scope.userinfo.sid
                    },
                }).success(function(result) {
                    $scope.consitiontion = result.data;
                }).error(function(data, status) {
                    console.log(" ");

                });
            };

            //提供删除调用
            $scope.selectStudentContisdLists2 = function() {
                var sid = getQueryVariable("sid");
                $http({
                    method: 'POST',
                    url: applicationUrl + 'constitution/api/listBySid',
                    headers: {
                        "Content-Type": 'application/x-www-form-urlencoded'
                    },
                    params: {
                        sid: sid
                    },
                }).success(function(result) {
                    $scope.consitiontion = result.data;
                    console.log("刷新成功");
                }).error(function(data, status) {
                    console.log(" ");

                });
            };
            //体质测试删除
            $scope.deleteContisdCid = function(cid) {
                var flag = confirm("是否要删除该条体质测试 ");
                if (flag == true) {
                    $http({
                        method: 'POST',
                        url: applicationUrl + 'constitution/api/deleteByCid',
                        headers: {
                            "Content-Type": 'application/x-www-form-urlencoded'
                        },
                        params: {
                            cid: cid
                        },
                    }).success(function(result) {
                        console.log(result.msg);
                        $scope.selectStudentContisdLists2();
                    }).error(function(data, status) {
                        console.log(" ");

                    });
                }

            };

            //查技能
            $scope.selectLevelkillStudent = function() {
                var sid = getQueryVariable("sid");
                $http({
                    method: 'POST',
                    url: applicationUrl + 'LevelkillStudent/api/listbysid',
                    headers: {
                        "Content-Type": 'application/x-www-form-urlencoded'
                    },
                    params: {
                        sid: sid
                    },
                }).success(function(result) {
                    $scope.leaveakillList = result.data;
                    console.log("刷新成功");
                }).error(function(data, status) {
                    console.log(" ");

                });
            };
            $scope.selectLevelkillStudent();

            //技能测试删除
            $scope.deletetLevelkillStudent = function(leid) {
                var flag = confirm("是否要删除该条技能测试 ");
                if (flag == true) {
                    $http({
                        method: 'POST',
                        url: applicationUrl + 'LevelkillStudent/api/delete',
                        headers: {
                            "Content-Type": 'application/x-www-form-urlencoded'
                        },
                        params: {
                            leid: leid
                        },
                    }).success(function(result) {
                        console.log(result.msg);
                        $scope.selectLevelkillStudent();
                    }).error(function(data, status) {
                        console.log(" ");

                    });
                }

            };


        }]);
    </script>
</body>

</html>